﻿Imports SIAVU.Dominio

Partial Public Class ActualizarDatos
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'cmbAnio.SelectedIndex = Date.Today.Year
        'cmbMes.SelectedIndex = Date.Today.Month - 1
    End Sub

#Region "Eventos"

    Protected Sub btnActualizar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnActualizar.Click
        Dim oInterfaceLegacy As New InterfaceLegacy

        Try
            If chkDatosTripulantes.Checked Then
                oInterfaceLegacy.ActualizarTripulantes()
            End If

            If chkPostas.Checked Then
                oInterfaceLegacy.ActualizarPostas(cmbAnio.SelectedItem.Value, cmbMes.SelectedItem.Value)
            End If

            Session("MensajeInformacion") = "Los datos se actualizaron exitosamente"
            Response.Redirect("MenuPrincipal.aspx", False)

        Catch ex As Exception
            'TODO Pagina de error
        Finally
            If (oInterfaceLegacy IsNot Nothing) Then oInterfaceLegacy = Nothing
        End Try
    End Sub

    Protected Sub chkPostas_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles chkPostas.CheckedChanged
        pnlPostas.Enabled = chkPostas.Checked
    End Sub

#End Region

End Class